]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Fix message markup getting lost
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 21 Feb 2015 19:10:41 +0000 (20:10 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 21 Feb 2015 19:20:57 +0000 (20:20 +0100)
We reuse the old body text on useMarkup changes and for expanded
labels. However just taking it from the label actor does not work
when markup is used, as once applied it will be stripped from
ClutterText:text.
So to preserve markup, keep our own copy of the original string
around.

https://bugzilla.gnome.org/show_bug.cgi?id=744907

js/ui/calendar.js

index eb1dd28b582d43769b77ca4c57ed05e3cae17335..4d407416836d5959c98e47ee1957fcdf67866ba1 100644 (file)
@@ -1024,9 +1024,10 @@ const Message = new Lang.Class({
         this._bodyStack.layout_manager = new LabelExpanderLayout();
         contentBox.add_actor(this._bodyStack);
 
-        this.bodyLabel = new URLHighlighter(body, false, this._useBodyMarkup);
+        this.bodyLabel = new URLHighlighter('', false, this._useBodyMarkup);
         this.bodyLabel.actor.add_style_class_name('message-body');
         this._bodyStack.add_actor(this.bodyLabel.actor);
+        this.setBody(body);
 
         this._closeButton.connect('clicked', Lang.bind(this,
             function() {
@@ -1053,6 +1054,7 @@ const Message = new Lang.Class({
     },
 
     setBody: function(text) {
+        this._bodyText = text;
         this.bodyLabel.setMarkup(text, this._useBodyMarkup);
     },
 
@@ -1061,7 +1063,7 @@ const Message = new Lang.Class({
             return;
         this._useBodyMarkup = enable;
         if (this.bodyLabel)
-            this.setBody(this.bodyLabel.actor.text);
+            this.setBody(this._bodyText);
     },
 
     setActionArea: function(actor) {
@@ -1101,7 +1103,7 @@ const Message = new Lang.Class({
         this._actionBin.visible = (this._actionBin.get_n_children() > 0);
 
         if (this._bodyStack.get_n_children() < 2) {
-            let expandedLabel = new URLHighlighter(this.bodyLabel.actor.text,
+            let expandedLabel = new URLHighlighter(this._bodyText,
                                                    true, this._useBodyMarkup);
             this.setExpandedBody(expandedLabel.actor);
         }